phy: spacemit: Introduce PCIe/combo PHY
authorAlex Elder <elder@riscstar.com>
Thu, 18 Dec 2025 15:12:29 +0000 (09:12 -0600)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 12 Mar 2026 12:28:10 +0000 (13:28 +0100)
commitd9fabf37d5d7a08d3e980496f758d479b608ab12
tree0e712f9931ea560123223831400c6a715879b28d
parentc4434af6da717e2ce2b0c7104ef2ba7c865b924d
phy: spacemit: Introduce PCIe/combo PHY

Origin: https://git.kernel.org/linus/57e920b92724dd568526990c04e79ed54241c5fc

Introduce a driver that supports three PHYs found on the SpacemiT
K1 SoC.  The first PHY is a combo PHY that can be configured for
use for either USB 3 or PCIe.  The other two PHYs support PCIe
only.

All three PHYs must be programmed with an 8 bit receiver termination
value, which must be determined dynamically.  Only the combo PHY is
able to determine this value.  The combo PHY performs a special
calibration step at probe time to discover this, and that value is
used to program each PHY that operates in PCIe mode.  The combo
PHY must therefore be probed before either of the PCIe-only PHYs
will be used.

Each PHY has an internal PLL driven from an external oscillator.
This PLL started when the PHY is first initialized, and stays
on thereafter.

During normal operation, the USB or PCIe driver using the PHY must
ensure (other) clocks and resets are set up properly.

However PCIe mode clocks are enabled and resets are de-asserted
temporarily by this driver to perform the calibration step on the
combo PHY.

Tested-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/all/ba532f8d-a452-40e5-af46-b58b89f70a92@linaro.org/
Tested-by: Yixun Lan <dlan@gentoo.org>
Link: https://patch.msgid.link/20251218151235.454997-4-elder@riscstar.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Gbp-Pq: Topic features/riscv64
Gbp-Pq: Name phy-spacemit-Introduce-PCIe-combo-PHY.patch
drivers/phy/Kconfig
drivers/phy/Makefile
drivers/phy/phy-spacemit-k1-pcie.c [new file with mode: 0644]